#pragma once
#ifndef __HWINCLASS_H__
#define __HWINCLASS_H__

#include "hwinobject.h"


namespace harlinn
{
    namespace windows
    {

        class WindowClass : public Object
        {
            String name;
            String menuName;

            UINT style;
            WNDPROC procedure;
            int classExtraBytes;
            int windowExtraBytes;
            HINSTANCE moduleHandle;
            HICON icon;
            HCURSOR cursor;
            HBRUSH backgroundBrush;
            HICON smallIcon;
        public:
            static String HWIN_EXPORT animate_class_name;
            static String HWIN_EXPORT datetimepick_class_name;
            static String HWIN_EXPORT hotkey_class_name;
            static String HWIN_EXPORT link_class_name;
            static String HWIN_EXPORT monthcal_class_name;
            static String HWIN_EXPORT nativefontctl_class_name;
            static String HWIN_EXPORT progress_class_name;
            static String HWIN_EXPORT rebar_class_name;
            static String HWIN_EXPORT status_class_name;
            static String HWIN_EXPORT toolbar_class_name;
            static String HWIN_EXPORT tooltips_class_name;
            static String HWIN_EXPORT trackbar_class_name;
            static String HWIN_EXPORT updown_class_name;
            static String HWIN_EXPORT button_class_name;
            static String HWIN_EXPORT combobox_class_name; 
            static String HWIN_EXPORT edit_class_name; 
            static String HWIN_EXPORT header_class_name;
            static String HWIN_EXPORT listbox_class_name;
            static String HWIN_EXPORT ipaddress_class_name;
            static String HWIN_EXPORT listview_class_name;
            static String HWIN_EXPORT pagescroller_class_name;
            static String HWIN_EXPORT scrollbar_class_name;
            static String HWIN_EXPORT static_class_name;
            static String HWIN_EXPORT tabcontrol_class_name;
            static String HWIN_EXPORT treeview_class_name;


            HWIN_EXPORT WindowClass();
            HWIN_EXPORT WindowClass(const WNDCLASSEX& wndClass);
            HWIN_EXPORT WindowClass(std::shared_ptr<const WindowClass> existingClass);
            HWIN_EXPORT ~WindowClass();

            HWIN_EXPORT WNDCLASSEX AsWNDCLASSEX() const;

            HWIN_EXPORT WindowClass& Register();


            HWIN_EXPORT const String& GetName() const;
            HWIN_EXPORT WindowClass& SetName( const String& theName);

            HWIN_EXPORT const String& GetMenuName() const;
            HWIN_EXPORT WindowClass& SetMenuName(const String& theMenuName);

            HWIN_EXPORT UINT GetStyle() const;
            HWIN_EXPORT WindowClass& SetStyle(UINT theStyle);

            HWIN_EXPORT WNDPROC GetProcedure() const;
            HWIN_EXPORT WindowClass& SetProcedure(WNDPROC theProcedure);

            HWIN_EXPORT int GetClassExtraBytes() const;
            HWIN_EXPORT WindowClass& SetClassExtraBytes(int theClassExtraBytes);

            HWIN_EXPORT int GetWindowExtraBytes() const;
            HWIN_EXPORT WindowClass& SetWindowExtraBytes(int theWindowExtraBytes);

            HWIN_EXPORT HINSTANCE GetModuleHandle() const;
            HWIN_EXPORT WindowClass& SetModuleHandle(HINSTANCE theModuleHandle);

            HWIN_EXPORT HICON GetIcon() const;
            HWIN_EXPORT WindowClass& SetIcon(HICON theIcon);

            HWIN_EXPORT HCURSOR GetCursor() const;
            HWIN_EXPORT WindowClass& SetCursor(HCURSOR theCursor);

            HWIN_EXPORT HBRUSH GetBackgroundBrush() const;
            HWIN_EXPORT WindowClass& SetBackgroundBrush(HBRUSH theBackgroundBrush);

            HWIN_EXPORT HICON GetSmallIcon() const;
            HWIN_EXPORT WindowClass& SetSmallIcon(HICON theSmallIcon);
            
        };


        

        class WindowClasses : public Object
        {
        public:

            typedef std::map<String, std::shared_ptr<WindowClass> > map_t;
        private:
            map_t map;

            void LoadStandardClasses();
            void LoadStandardClass(const String& className);
        public:
            HWIN_EXPORT WindowClasses();
            HWIN_EXPORT ~WindowClasses();
            
            static HWIN_EXPORT std::shared_ptr<WindowClass> GetClassInfo(const String& className);
            static HWIN_EXPORT std::shared_ptr<WindowClass> GetClassInfo(HINSTANCE hInstance, const String& className);


            HWIN_EXPORT std::shared_ptr<WindowClass> GetWindowClass(const String& className) const;
            HWIN_EXPORT bool Register(std::shared_ptr<WindowClass> theWindowClass);
        };

    };
};


#endif //__HWINMESSAGE_H__